package com.td.erhome.utils;

import android.app.Activity;
import android.app.Dialog;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.support.annotation.IdRes;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.aigestudio.wheelpicker.WheelPicker;
import com.aigestudio.wheelpicker.widgets.WheelDatePicker;
import com.td.erhome.R;
import com.td.erhome.adapter.CheckAdapter;
import com.td.erhome.adapter.PopMoreAdapter;
import com.td.erhome.adapter.popAdapterAreaOne;
import com.td.erhome.adapter.popAdapterAreaTwo;
import com.td.erhome.models.BugHouseFiltrateBean;
import com.td.erhome.models.CityInfoLitePal;
import com.td.erhome.models.CiyiInfoBean;
import com.td.erhome.models.FloorBean;
import com.td.erhome.models.HouseArea;
import com.td.erhome.models.HouseBean;
import com.td.erhome.models.KeyStribgBean;
import com.td.erhome.models.MoreBean;
import com.td.erhome.models.MoreTotleBean;
import com.td.erhome.models.PayMethod;
import com.td.erhome.ui.article.ArticleContentActivity;

import org.litepal.crud.DataSupport;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.onekeyshare.OnekeyShare;
import cn.sharesdk.wechat.friends.Wechat;
import cn.sharesdk.wechat.moments.WechatMoments;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;

import static com.td.erhome.R.id.tv_sure;
import static com.td.erhome.R.id.wheel3;

/**
 * Created by Administrator on 2017/4/18 0018.
 *  http://sifang.space/apidoc
 */

public class DialogUtils {

    private  String wheelData1 = "1室";
    private  String wheelData2 = "0厅";
    private  String wheelData3 = "0卫";
    private  int wheelInt = 0;
    private  List<String> mList;
    private  int wheelData1Int;
    private  int wheelData2Int;
    private  int wheelData3Int;
    private  List<CityInfoLitePal> cityInfoLitePals1;
    private  String holLc = "1";
    private  String pointLc = "1";
    private long mArea_id = 0; //筛选室的街道id
    private String price = ""; //筛选价格
    private int rooms = 1; //筛选几室
    private String price_type = "1";//筛选价格

    private int positionOne= -1;
    private int positionTwo= -1;
    private int positionThree= -1;
    private int positionFour= -1;
    private Subscription mSubscribe;
    private int house_area = 1;
    private int decCondition = 1;
    private int house_age =1;
    private int orientations =1;
    private int mArea1;
    private int mArea2;
    public static int mPosition = 0;
    public static int mAreaPoint = 0;
    private List<CityInfoLitePal> mCityInfoLitePals;
    private String mTitle;
    private String mUrl;
    String pay_type = "alipay";
    private String content;
    int imgType = 1;

    //分享到
    public  void createTopUp(Context mContext,TextView textView,String ctitle,String curl,String con) {
        mTitle = ctitle;
        mUrl = curl;
        content = con;


        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_dialog, null);

        TextView tvFxWx = (TextView)v.findViewById(R.id.tv_fx_wx);
        TextView tvFxPyq = (TextView)v.findViewById(R.id.tv_fx_pyq);
        TextView tvFxQx = (TextView)v.findViewById(R.id.tv_qx);


        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        tvFxWx.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvFxPyq.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvFxQx.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));


        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置
        window.setWindowAnimations(R.style.AnimationFadeBottom); // 添加动画
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }

    /**
     * 区域选择
     */
    public  void initPopChoiceCarWindow(final Activity mContext, View re, final View ground, final CheckBox checkBox,int area1,int area2) {

        // 获取自定义布局文件activity_popupwindow_left.xml的视图
        View popChoiceCarWindow_view = mContext.getLayoutInflater().inflate(R.layout.choice_area, null, false);

        RecyclerView recyclerViewOne = (RecyclerView) popChoiceCarWindow_view.findViewById(R.id.recyclview_one);
        final RecyclerView recyclerViewTwo = (RecyclerView) popChoiceCarWindow_view.findViewById(R.id.recyclview_two);

        recyclerViewOne.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false));
        recyclerViewTwo.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false));

        ArrayList<String> list = new ArrayList<>();
        final ArrayList<String> data1 = new ArrayList<>();
        final popAdapterAreaTwo popAdapterAreaTwo = new popAdapterAreaTwo(mContext, data1);
        recyclerViewTwo.setAdapter(popAdapterAreaTwo);
        popAdapterAreaTwo.setPoint(area2);

        final List<CityInfoLitePal> cityInfoLitePals = DataSupport.where("area_id LIKE ?", "%000").find(CityInfoLitePal.class);
         list.add("不限");
        for (int i = 0; i < cityInfoLitePals.size(); i++) {
            list.add(cityInfoLitePals.get(i).area_name);
        }
        popAdapterAreaOne popAdapterAreaOne = new popAdapterAreaOne(mContext, list);
        recyclerViewOne.setAdapter(popAdapterAreaOne);
        popAdapterAreaOne.setPoint(area1);

        if (area1!=0){
            data1.add("不限");
            cityInfoLitePals1 = DataSupport.where("area_id LIKE ? AND area_id not LIKE '%000'",(cityInfoLitePals.get(area1-1).area_id/1000)+"%").find(CityInfoLitePal.class);

            for (int i = 0; i < cityInfoLitePals1.size() ; i++) {
                data1.add(cityInfoLitePals1.get(i).area_name);
            }
        }
        popAdapterAreaTwo.resetData(data1,area2);


        // 创建PopupWindow实例,200,LayoutParams.MATCH_PARENT分别是宽度和高度
        final PopupWindow[] popChoiceCarWindow = {new PopupWindow(popChoiceCarWindow_view, ViewGroup.LayoutParams.MATCH_PARENT, mContext.getWindowManager().getDefaultDisplay().getHeight()/2, true)};

        //菜单背景色
        ColorDrawable dw = new ColorDrawable(0xffffffff);
        popChoiceCarWindow[0].setBackgroundDrawable(dw);

        ground.setVisibility(View.VISIBLE);

        popAdapterAreaOne.setOnItemClickListener(new popAdapterAreaOne.OnRecyclerViewItemClickListener() {
            @Override
            public void onItemClick(int sn) {
                data1.clear();
                mArea1 = sn;
                if (sn!=0){
                    data1.add("不限");
                    cityInfoLitePals1 = DataSupport.where("area_id LIKE ? AND area_id not LIKE '%000'",(cityInfoLitePals.get(sn-1).area_id/1000)+"%").find(CityInfoLitePal.class);

                    for (int i = 0; i < cityInfoLitePals1.size() ; i++) {
                        data1.add(cityInfoLitePals1.get(i).area_name);
                    }

                    popAdapterAreaTwo.resetData(data1,0);
                }else {
                    mArea_id = 0;
                    RxBus.getInstance().post(new BugHouseFiltrateBean(mArea_id,price_type,rooms,mArea1,mArea2));
                    popChoiceCarWindow[0].dismiss();
                }

            }
        });

        popAdapterAreaTwo.setOnItemClickListener(new popAdapterAreaTwo.OnRecyclerViewItemClickListener() {
            @Override
            public void onItemClick(int sn) {
                mArea2 = sn;
                if (sn==0){
                    mArea_id = (cityInfoLitePals1.get(1).area_id/1000)*1000;
                }else {
                    mArea_id = cityInfoLitePals1.get(sn-1).area_id;
                }
                RxBus.getInstance().post(new BugHouseFiltrateBean(mArea_id,price_type,rooms,mArea1,mArea2));
                popChoiceCarWindow[0].dismiss();
            }
        });


        //将这两个属性设置为false，使点击popupwindow外面其他地方不会消失
       // popChoiceCarWindow.setOutsideTouchable(false);
       // popChoiceCarWindow.setFocusable(false);
        int contentHeight=ViewUtils.getViewMeasuredHeight(popChoiceCarWindow_view);

        //关闭事件
        popChoiceCarWindow[0].setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                checkBox.setChecked(false);
                ground.setVisibility(View.GONE);
            }
        });


       popChoiceCarWindow_view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (popChoiceCarWindow[0] != null && popChoiceCarWindow[0].isShowing()) {
                    popChoiceCarWindow[0].dismiss();
                    checkBox.setChecked(false);
                    ground.setVisibility(View.GONE);
                    popChoiceCarWindow[0] = null;
                }
                return false;
            }
        });

        popChoiceCarWindow[0].showAsDropDown(re,0,0);
      //  int fromYDelta=-contentHeight-100;
     //   popChoiceCarWindow[0].getContentView().startAnimation(AnimationUtil.createInAnimation(mContext, fromYDelta));

    }

    /**
     * 价格选择
     */
    public   void initPopChoicePriceWindow(final Activity mContext, final View re, final View ground, final CheckBox checkBox, String type) {

        // 获取自定义布局文件activity_popupwindow_left.xml的视图
        View popChoiceCarWindow_view = mContext.getLayoutInflater().inflate(R.layout.choice_price, null, false);

        final EditText etFirstPrice = (EditText) popChoiceCarWindow_view.findViewById(R.id.et_first_price);
        final EditText etToPrice = (EditText) popChoiceCarWindow_view.findViewById(R.id.et_to_price);
        TextView tvSureEt = (TextView) popChoiceCarWindow_view.findViewById(R.id.tv_sure_et);

        RadioGroup viewGroup = (RadioGroup) popChoiceCarWindow_view.findViewById(R.id.view_group);

         try{
           int temp = Integer.parseInt(type);
            ((RadioButton)viewGroup.getChildAt(temp-1)).setChecked(true);
        }catch(Exception e){
             String[] split = type.split(",");
             etFirstPrice.setText(split[0]);
             etToPrice.setText(split[1]);
         }
        // 创建PopupWindow实例,200,LayoutParams.MATCH_PARENT分别是宽度和高度
        final PopupWindow[] popChoiceCarWindow = {new PopupWindow(popChoiceCarWindow_view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true)};

        //菜单背景色
        ColorDrawable dw = new ColorDrawable(0xffffffff);
        popChoiceCarWindow[0].setBackgroundDrawable(dw);

        ground.setVisibility(View.VISIBLE);

        tvSureEt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (TextUtil.isEditTextEmpty(etFirstPrice)){
                  T.showLong(mContext,"请输入正确的价格范围");
                  return;
              }
              if (TextUtil.isEditTextEmpty(etToPrice)){
                  T.showLong(mContext,"请输入正确的价格范围");
                  return;
              }
                price_type = etFirstPrice.getText().toString()+","+etToPrice.getText().toString();
                RxBus.getInstance().post(new BugHouseFiltrateBean(mArea_id,price_type,rooms,mArea1,mArea2));
                popChoiceCarWindow[0].dismiss();
            }
        });




        viewGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
                switch (checkedId){
                    case R.id.radio1:
                        price_type = "1";
                        break;
                    case R.id.radio2:
                        price_type = "2";
                        break;
                    case R.id.radio3:
                        price_type = "3";
                        break;
                    case R.id.radio4:
                        price_type = "4";
                        break;
                    case R.id.radio5:
                        price_type = "5";
                        break;
                    case R.id.radio6:
                        price_type = "6";
                        break;
                    case R.id.radio7:
                        price_type = "7";
                        break;
                    case R.id.radio8:
                        price_type = "8";
                        break;
                }
                RxBus.getInstance().post(new BugHouseFiltrateBean(mArea_id,price_type,rooms,mArea1,mArea2));
                popChoiceCarWindow[0].dismiss();
            }
        });

        //将这两个属性设置为false，使点击popupwindow外面其他地方不会消失
      //  popChoiceCarWindow[0].setOutsideTouchable(false);
       // popChoiceCarWindow[0].setFocusable(false);


        //关闭事件
        popChoiceCarWindow[0].setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                checkBox.setChecked(false);
                ground.setVisibility(View.GONE);
            }
        });

        popChoiceCarWindow_view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (popChoiceCarWindow[0] != null && popChoiceCarWindow[0].isShowing()) {
                    popChoiceCarWindow[0].dismiss();
                    checkBox.setChecked(false);
                    ground.setVisibility(View.GONE);
                    popChoiceCarWindow[0] = null;
                }
                return false;
            }
        });
        popChoiceCarWindow[0].showAsDropDown(re,0,0);
    }

    /**
     * 户型选择
     */
    public   void initPopChoiceHxWindow(Activity mContext, View re, final View ground, final CheckBox checkBox,int type) {

        // 获取自定义布局文件activity_popupwindow_left.xml的视图
        View popChoiceCarWindow_view = mContext.getLayoutInflater().inflate(R.layout.choice_hx, null, false);
        RadioGroup viewGroup = (RadioGroup) popChoiceCarWindow_view.findViewById(R.id.view_group);
        ((RadioButton)viewGroup.getChildAt(type-1)).setChecked(true);

        // 创建PopupWindow实例,200,LayoutParams.MATCH_PARENT分别是宽度和高度
        final PopupWindow[] popChoiceCarWindow = {new PopupWindow(popChoiceCarWindow_view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, true)};

        //菜单背景色
        ColorDrawable dw = new ColorDrawable(0xffffffff);
        popChoiceCarWindow[0].setBackgroundDrawable(dw);

        ground.setVisibility(View.VISIBLE);

        viewGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
                switch (checkedId){
                    case R.id.radio1:
                        rooms = 1;
                        break;
                    case R.id.radio2:
                        rooms = 2;
                        break;
                    case R.id.radio3:
                        rooms = 3;
                        break;
                    case R.id.radio4:
                        rooms = 4;
                        break;
                    case R.id.radio5:
                        rooms = 5;
                        break;
                    case R.id.radio6:
                        rooms = 6;
                        break;
                }

                RxBus.getInstance().post(new BugHouseFiltrateBean(mArea_id,price_type,rooms,mArea1,mArea2));
                popChoiceCarWindow[0].dismiss();
            }
        });

        //将这两个属性设置为false，使点击popupwindow外面其他地方不会消失
        //  popChoiceCarWindow[0].setOutsideTouchable(false);
        // popChoiceCarWindow[0].setFocusable(false);
        int contentHeight=ViewUtils.getViewMeasuredHeight(popChoiceCarWindow_view);

        //关闭事件
        popChoiceCarWindow[0].setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                checkBox.setChecked(false);
                ground.setVisibility(View.GONE);
            }
        });


        popChoiceCarWindow_view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (popChoiceCarWindow[0] != null && popChoiceCarWindow[0].isShowing()) {
                    popChoiceCarWindow[0].dismiss();
                    checkBox.setChecked(false);
                    ground.setVisibility(View.GONE);
                    popChoiceCarWindow[0] = null;
                }
                return false;
            }
        });

        popChoiceCarWindow[0].showAsDropDown(re,0,0);

    }

    /**
     * 更多选择
     */
    public   void initPopChoiceMoreWindow(Activity mContext, View re, final View ground, final CheckBox checkBox,
                                          int area,int condition,int orien,int age) {
        this.house_area = area;
        this.decCondition= condition;
        this.orientations= orien;
        this.house_age= age;

        // 获取自定义布局文件activity_popupwindow_left.xml的视图
        View popChoiceCarWindow_view = mContext.getLayoutInflater().inflate(R.layout.choice_more, null, false);
        RecyclerView recyclerViewMj = (RecyclerView) popChoiceCarWindow_view.findViewById(R.id.recyview_mj);
        RecyclerView recyclerViewCx = (RecyclerView) popChoiceCarWindow_view.findViewById(R.id.recyview_cx);
        RecyclerView recyclerViewZx = (RecyclerView) popChoiceCarWindow_view.findViewById(R.id.recyview_zx);
        RecyclerView recyclerViewFl = (RecyclerView) popChoiceCarWindow_view.findViewById(R.id.recyview_fl);
        TextView tvSure = (TextView) popChoiceCarWindow_view.findViewById(tv_sure);
        TextView tvClear = (TextView) popChoiceCarWindow_view.findViewById(R.id.tv_clear);

        String[] s = {"不限","50㎡以下","50-70㎡","70-90㎡","90-110㎡","110-130㎡","130-150㎡","150㎡以上"};
        recyclerViewMj.setLayoutManager(new GridLayoutManager(mContext, 4));
        final PopMoreAdapter OneAdapter = new PopMoreAdapter(mContext, s, house_area - 1, ConstUtils.MORE_AREA);
        recyclerViewMj.setAdapter(OneAdapter);

        String[] s1 = {"不限","南","东","西","北","东南","西南","东北","西北","南北通透","东西通透"};
        recyclerViewCx.setLayoutManager(new GridLayoutManager(mContext, 4));
        final PopMoreAdapter TwoAdapter = new PopMoreAdapter(mContext, s1, orientations - 1, ConstUtils.MORE_ORIEN);
        recyclerViewCx.setAdapter(TwoAdapter);

        String[] s2 = {"不限","毛坯","简装","中装","精装","豪装"};
        recyclerViewZx.setLayoutManager(new GridLayoutManager(mContext, 4));
        final PopMoreAdapter ThreAdapter = new PopMoreAdapter(mContext, s2, decCondition - 1, ConstUtils.MORE_CONDI);
        recyclerViewZx.setAdapter(ThreAdapter);

        String[] s3 = {"不限","2年以下","2-5年","5-10年","10年以上"};
        recyclerViewFl.setLayoutManager(new GridLayoutManager(mContext, 4));
        final PopMoreAdapter fourAdapter = new PopMoreAdapter(mContext, s3, house_age - 1, ConstUtils.MORE_AGE);
        recyclerViewFl.setAdapter(fourAdapter);
        mSubscribe = RxBus.getInstance().toObserverable(MoreBean.class)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<MoreBean>() {

                    @Override
                    public void call(MoreBean moreBean) {
                        if (moreBean.type==ConstUtils.MORE_AREA){
                            house_area = moreBean.point+1;
                        }
                        if (moreBean.type==ConstUtils.MORE_CONDI){
                            decCondition = moreBean.point+1;
                        }
                        if (moreBean.type == ConstUtils.MORE_ORIEN){
                            orientations = moreBean.point+1;
                        }
                        if (moreBean.type == ConstUtils.MORE_AGE){
                            house_age = moreBean.point+1;
                        }

                    }
                });

        // 创建PopupWindow实例,200,LayoutParams.MATCH_PARENT分别是宽度和高度
        final PopupWindow[] popChoiceCarWindow = {new PopupWindow(popChoiceCarWindow_view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true)};

        //菜单背景色
        ColorDrawable dw = new ColorDrawable(0xffffffff);
        popChoiceCarWindow[0].setBackgroundDrawable(dw);

        ground.setVisibility(View.VISIBLE);

        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RxBus.getInstance().post(new MoreTotleBean(house_area,decCondition,orientations,house_age));
                popChoiceCarWindow[0].dismiss();
            }
        });

        tvClear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                house_area = 1;
                decCondition = 1;
                house_age =1;
                orientations =1;

                 OneAdapter.resetPoint(house_area-1);
                TwoAdapter.resetPoint(decCondition-1);
                ThreAdapter.resetPoint(house_age-1);
                fourAdapter.resetPoint(orientations-1);
            }
        });


        //将这两个属性设置为false，使点击popupwindow外面其他地方不会消失
        //  popChoiceCarWindow[0].setOutsideTouchable(false);
        // popChoiceCarWindow[0].setFocusable(false);


        //关闭事件
        popChoiceCarWindow[0].setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                checkBox.setChecked(false);
                ground.setVisibility(View.GONE);
                if (!mSubscribe.isUnsubscribed()){
                    mSubscribe.unsubscribe();
                }
                 house_area = 1;
                 decCondition = 1;
                 house_age =1;
                 orientations =1;
            }
        });


        popChoiceCarWindow_view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (popChoiceCarWindow[0] != null && popChoiceCarWindow[0].isShowing()) {
                    popChoiceCarWindow[0].dismiss();
                    checkBox.setChecked(false);
                    ground.setVisibility(View.GONE);
                    popChoiceCarWindow[0] = null;
                    if (!mSubscribe.isUnsubscribed()){
                        mSubscribe.unsubscribe();
                    }
                     house_area = 1;
                    decCondition = 1;
                     house_age =1;
                     orientations =1;
                }
                return false;
            }
        });

        popChoiceCarWindow[0].showAsDropDown(re,0,0);
    }

    //选择、朝向、楼层,单个wheel等
    public  void createBottom(Context mContext,List<String> data,TextView textView) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_wheel, null);

        int index = textView.getText().toString() != "" ? data.indexOf(textView.getText().toString()) : 0;

        WheelPicker wheel = (WheelPicker) v.findViewById(R.id.wheel);
        TextView tvCancel = (TextView) v.findViewById(R.id.tv_cancel);
        TextView tvSure = (TextView) v.findViewById(R.id.tv_sure1);
        wheel.setData(data);
        wheel.setSelectedItemPosition(index);
        mList = data;

        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消
        wheel.setOnItemSelectedListener(new IntemListener());
        tvCancel.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvSure.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置
        window.setWindowAnimations(R.style.AnimationFadeBottom); // 添加动画
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
    //选择楼层
    public  void createlcBottom(Context mContext,TextView textView,FloorBean floorBean) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_wheel_lc, null);

        WheelPicker wheel1 = (WheelPicker) v.findViewById(R.id.wheel1);
        final WheelPicker wheel2 = (WheelPicker) v.findViewById(R.id.wheel2);

        TextView tvCancel = (TextView) v.findViewById(R.id.tv_cancel);
        TextView tvSure = (TextView) v.findViewById(R.id.tv_sure_lc);
        if (floorBean!=null){
            holLc = floorBean.hotelLc;
            pointLc = floorBean.pointLc;
        }


        List<String> data;
        data = new ArrayList<>();
        for (int i = 1; i <51 ; i++) {
            data.add(i+"");
        }
        wheel1.setData(data);
        wheel1.setSelectedItemPosition(Integer.parseInt(holLc) - 1);

        data = new ArrayList<>();
        for (int i = 1; i <Integer.parseInt(holLc)+1 ; i++) {
            data.add(i+"");
        }
        wheel2.setSelectedItemPosition(Integer.parseInt(pointLc) - 1);
        wheel2.setData(data);

        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        wheel1.setOnItemSelectedListener(new WheelPicker.OnItemSelectedListener() {
            @Override
            public void onItemSelected(WheelPicker picker, Object data, int position) {

                holLc = (String)data;
                List<String> data1 = new ArrayList<>();
                for (int i = 1; i <position+2 ; i++) {
                    data1.add(i+"");
                }
                wheel2.setData(data1);
            }
        });
        wheel2.setOnItemSelectedListener(new WheelPicker.OnItemSelectedListener() {
            @Override
            public void onItemSelected(WheelPicker picker, Object data, int position) {
                pointLc = (String)data;
            }
        });

        tvCancel.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvSure.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置

        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
    //选择房屋配套设施
    public  void createCheckBox(Context mContext, final TextView textView) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_recyclview, null);
        RecyclerView recyclerView = (RecyclerView) v.findViewById(R.id.recyclview);
        TextView tvCancel = (TextView) v.findViewById(R.id.tv_cancel);
        TextView tvSure = (TextView) v.findViewById(R.id.tv_sure);

        recyclerView.setLayoutManager(new GridLayoutManager(mContext,4));
        ArrayList<String> list = new ArrayList<>();
        list.add("小院");
        list.add("阁楼");
        list.add("露台");
        list.add("家电");
        list.add("家具");
        list.add("暖气");
        list.add("天然气");
        list.add("车位/车库");
        list.add("地下室");
        list.add("电梯");
        list.add("地铁");
        list.add("公交站");
        list.add("商场");
        list.add("步行街");
        list.add("学校");
        list.add("医院");

        final CheckAdapter checkAdapter = new CheckAdapter(mContext, list);
        recyclerView.setAdapter(checkAdapter);

        if (textView.getText().toString()!=""){
            String[] split = textView.getText().toString().split(" ");

            for (int i = 0; i <split.length ; i++) {
                int index = list.indexOf(split[i]);
                checkAdapter.setItemChecked(index,true);
                checkAdapter.notifyDataSetChanged();
            }
        }



        // 创建自定义样式dialog
        final Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HashMap<Integer, String> selectedItem = checkAdapter.getSelectedItem();
                StringBuffer b = new StringBuffer();
                StringBuffer keyInt = new StringBuffer();

                Set set = selectedItem.keySet();
                Iterator iter = set.iterator();
                while (iter.hasNext()) {
                    int key =  (int)iter.next();
                    b.append(selectedItem.get(key)+" ");
                    keyInt.append(key+" ");
                }

                textView.setText(b.toString());
                RxBus.getInstance().post(new KeyStribgBean(keyInt.toString()));
                mLoadingDialog.dismiss();

            }
        });

        tvCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mLoadingDialog.dismiss();
            }
        });

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置
        window.setWindowAnimations(R.style.AnimationFadeBottom); // 添加动画
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
    //购买时间
    public  void createTime(Context mContext, final TextView textView) {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_wheel_time, null);
        final WheelDatePicker wheel = (WheelDatePicker) v.findViewById(R.id.wheel);
        TextView tvSure = (TextView) v.findViewById(R.id.tv_time_sure);
        TextView tvCancel = (TextView) v.findViewById(R.id.tv_cancel);


        wheel.setSelectedItemTextColor(R.color.color_0b9676);
        wheel.setVisibleItemCount(3);
        wheel.setAtmospheric(true);
        wheel.setCurved(true);
        // 创建自定义样式dialog
        final Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        tvCancel.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Date currentDate = wheel.getCurrentDate();
                textView.setText(TimeUtils.date2String(currentDate,"yyyy-MM-dd"));
                mLoadingDialog.dismiss();
            }
        });

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置
        window.setWindowAnimations(R.style.AnimationFadeBottom); // 添加动画
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
       //付费获取房主信息  押金缴纳
    public   void initPopGetInfo(final Activity mContext, int type) {


        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.get_info, null);
        TextView tvPayDetails = (TextView) v.findViewById(R.id.tv_pay_details);
        TextView tvPayMoney = (TextView) v.findViewById(R.id.tv_pay_money);
        TextView tvPayMoney1 = (TextView) v.findViewById(R.id.tv_pay_money1);
        final TextView tvAliPay = (TextView) v.findViewById(R.id.tv_ali_pay);
        final TextView tvWxPay = (TextView) v.findViewById(R.id.tv_wx_pay);
        RelativeLayout reYhq = (RelativeLayout) v.findViewById(R.id.re_yhq);

        TextView tvDeal = (TextView) v.findViewById(R.id.tv_deal);
        TextView tvDeal1 = (TextView) v.findViewById(R.id.tv_deal1);

        final ImageView imgSure = (ImageView) v.findViewById(R.id.img_sure);
        final ImageView imgArgee = (ImageView) v.findViewById(R.id.img_argee);

        imgArgee.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (imgType==1){
                    imgType=2;
                    imgArgee.setImageResource(R.mipmap.wyyd);
                    imgSure.setImageResource(R.mipmap.ayment_details_btn_disabled);
                    imgSure.setEnabled(false);
                }else {
                    imgType=1;
                    imgArgee.setImageResource(R.mipmap.pay_particulars_icon_tick);
                    imgSure.setImageResource(R.mipmap.td_ljzf);
                    imgSure.setEnabled(true);
                }
                }

        });

         final Intent intent = new Intent(mContext, ArticleContentActivity.class);

        if (type==2){
            tvPayDetails.setText("支付押金");
            tvPayMoney.setText(UserManager.getIns().getUser().seller_sell_house_amount);
            tvPayMoney1.setText(UserManager.getIns().getUser().seller_sell_house_amount);
            //创建一个 SpannableString对象
            tvDeal1.setText("《四方腾达押金协议》");
            intent.putExtra("url","http://sifangtengda.top/push_agreement.html");
            intent.putExtra("title","四方腾达押金协议");
            reYhq.setVisibility(View.GONE);
        }else {
             tvPayDetails.setText("支付详情");
            tvPayMoney.setText(UserManager.getIns().getUser().buyer_see_house_amount);
            tvPayMoney1.setText(UserManager.getIns().getUser().seller_sell_house_amount);
            tvDeal1.setText("《四方腾达信息提供服务协议》");
            intent.putExtra("url","http://sifangtengda.top/query_agreement.html");
            intent.putExtra("title","四方腾达信息提供服务协议");
             reYhq.setVisibility(View.GONE);
        }

        tvDeal1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mContext.startActivity(intent);
            }
        });

       /* //设置高亮样式二
        sp.setSpan(new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_048d99)),7,end, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
        sp.setSpan(new ClickableSpan() {
            @Override
            public void onClick(View widget) {
                mContext.startActivity(intent);
            }
        },7,end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        tvDeal.setMovementMethod(LinkMovementMethod.getInstance());
        tvDeal.setHighlightColor(Color.TRANSPARENT);

        tvDeal.setText(sp);*/


        RelativeLayout reAliPay = (RelativeLayout) v.findViewById(R.id.re_ali_pay);
        RelativeLayout reWxPay = (RelativeLayout) v.findViewById(R.id.re_wx_pay);

        final ImageView imgAliPay = (ImageView) v.findViewById(R.id.img_ali_pay);
        final ImageView imgWxPay = (ImageView) v.findViewById(R.id.img_wx_pay);

        // 创建自定义样式dialog
        final Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        reAliPay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imgAliPay.setImageResource(R.mipmap.td_pay_select);
                imgWxPay.setImageResource(R.mipmap.wxz);
                pay_type = "alipay";
            }
        });

        reWxPay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imgAliPay.setImageResource(R.mipmap.wxz);
                imgWxPay.setImageResource(R.mipmap.td_pay_select);
                pay_type = "wechatpay";
            }
        });

        imgSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RxBus.getInstance().post(new PayMethod(pay_type));
                mLoadingDialog.dismiss();
            }
        });

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置
        window.setWindowAnimations(R.style.AnimationFadeBottom); // 添加动画
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
    /**
     * 显示房主信息
     * @param mContext
     */
    public   void initPopShowInfo(final Activity mContext, final HouseBean.SellHouseListBean houseListBean) {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.show_info, null);
        ImageView imgHead = (ImageView) v.findViewById(R.id.img_head);
        TextView name = (TextView) v.findViewById(R.id.name);
        TextView adress = (TextView) v.findViewById(R.id.adress);
        TextView phone = (TextView) v.findViewById(R.id.phone);
        TextView wx = (TextView) v.findViewById(R.id.wx);

        ImageLoader.loadCicleImage(mContext,houseListBean.seller_head_img,R.mipmap.td_min_tx,imgHead);
        name.setText(houseListBean.true_name.substring(0,1)+"**");
        adress.setText("地址:"+houseListBean.address);
        phone.setText("电话:"+houseListBean.mobile);
        wx.setText("微信:"+houseListBean.wechat_no);

        phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CallUtils.call(mContext,houseListBean.mobile);
            }
        });

        wx.setOnClickListener(new View.OnClickListener() { //复制到粘贴板
            @Override
            public void onClick(View v) {
                ClipboardManager cmb = (ClipboardManager)mContext.getSystemService(Context.CLIPBOARD_SERVICE);
                cmb.setText(houseListBean.wechat_no);
                T.showLong(mContext,"复制成功");
            }
        });

        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.CENTER);  //此处可以设置dialog显示的位置
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();


    }
    //选择房屋户型
    public  void createHomeBottom(Context mContext,TextView textView) {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_wheel_hx, null);

        WheelPicker wheel1 = (WheelPicker) v.findViewById(R.id.wheel1);
        WheelPicker wheel2 = (WheelPicker) v.findViewById(R.id.wheel2);
        WheelPicker wheel3 = (WheelPicker) v.findViewById(R.id.wheel3);
        TextView tvCancel = (TextView) v.findViewById(R.id.tv_cancel);
        TextView tvSure = (TextView) v.findViewById(tv_sure);
        if (textView.getText().toString().trim()!=""){
            wheelData1Int = Integer.parseInt(textView.getText().toString().substring(0,1));
            wheelData2Int = Integer.parseInt(textView.getText().toString().substring(2,3));
            wheelData3Int = Integer.parseInt(textView.getText().toString().substring(4,5));
        }

        List<String> data;
        data = new ArrayList<>();
        for (int i = 1; i < 6; i++){
            data.add(i+"室");
        }
        wheel1.setData(data);
        wheel1.setSelectedItemPosition(wheelData1Int-1);

        data = new ArrayList<>();
        for (int i = 0; i < 6; i++){
            data.add(i+"厅");
        }
        wheel2.setData(data);
        wheel2.setSelectedItemPosition(wheelData2Int);

        data = new ArrayList<>();
        for (int i = 0; i < 6; i++){
            data.add(i+"卫");
        }
        wheel3.setData(data);
        wheel3.setSelectedItemPosition(wheelData3Int);

        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        wheel1.setOnItemSelectedListener(new IntemListener());
        wheel2.setOnItemSelectedListener(new IntemListener());
        wheel3.setOnItemSelectedListener(new IntemListener());
        tvCancel.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvSure.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置

        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
    //选择地址
    public  void createAddressBottom(Context mContext,TextView textView) {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.bottom_wheel_dz, null);

        WheelPicker wheel1 = (WheelPicker) v.findViewById(R.id.wheel1);
        final WheelPicker wheel2 = (WheelPicker) v.findViewById(R.id.wheel2);

        TextView tvCancel = (TextView) v.findViewById(R.id.tv_cancel);
        TextView tvSure = (TextView) v.findViewById(R.id.tv_sure_ad);

        String[] split = textView.getText().toString().split("   ");


        List<String> data;
        data = new ArrayList<>();

        mCityInfoLitePals = DataSupport.where("area_id LIKE ?", "%000").find(CityInfoLitePal.class);
        for (int i = 0; i < mCityInfoLitePals.size() ; i++) {
            data.add(mCityInfoLitePals.get(i).area_name);
        }
        wheel1.setData(data);
        mAreaPoint =(split.length==2 ? data.indexOf(split[0]) : 0);
        wheel1.setSelectedItemPosition(mAreaPoint);

        data = new ArrayList<>();
        cityInfoLitePals1 = DataSupport.where("area_id LIKE ? AND area_id not LIKE '%000'",(mCityInfoLitePals.get(mAreaPoint).area_id/1000)+"%").find(CityInfoLitePal.class);

        for (int i = 0; i < cityInfoLitePals1.size() ; i++) {
            data.add(cityInfoLitePals1.get(i).area_name);
        }
        wheel2.setData(data);
        mPosition =  (split.length== 2 ? data.indexOf(split[1]) : 0);
        wheel2.setSelectedItemPosition(mPosition);

        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);

        wheel1.setOnItemSelectedListener(new WheelPicker.OnItemSelectedListener() {
            @Override
            public void onItemSelected(WheelPicker picker, Object data, int position) {
                mAreaPoint = position;

                List<String> data1 = new ArrayList<>();
                cityInfoLitePals1 = DataSupport.where("area_id LIKE ? AND area_id not LIKE '%000'",(mCityInfoLitePals.get(position).area_id/1000)+"%").find(CityInfoLitePal.class);

                for (int i = 0; i < cityInfoLitePals1.size() ; i++) {
                    data1.add(cityInfoLitePals1.get(i).area_name);
                }
                wheel2.setData(data1);
                wheel2.setSelectedItemPosition(0);
                mPosition = 0;
            }
        });

        wheel2.setOnItemSelectedListener(new WheelPicker.OnItemSelectedListener() {
            @Override
            public void onItemSelected(WheelPicker picker, Object data, int position) {
                mPosition = position;
            }
        });

        tvCancel.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));
        tvSure.setOnClickListener(new CliceListener(mLoadingDialog,mContext,textView));

        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消

        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);  //此处可以设置dialog显示的位置

        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        mLoadingDialog.show();
    }
    //自定义loading
    public  Dialog loading(Activity mContext ){
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.lodding, null);

        // 创建自定义样式dialog
        Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);
        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消
        mLoadingDialog.setCanceledOnTouchOutside(false);// 设置点击屏幕Dialog不消失
        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.CENTER);  //此处可以设置dialog显示的位置

        return mLoadingDialog;

    }

    //进入卖房列表的提示信息
    public static void mesg(Activity mContext ){
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.mesg, null);
        TextView tvSure = (TextView) v.findViewById(R.id.tv_sure);

        // 创建自定义样式dialog
        final Dialog mLoadingDialog = new Dialog(mContext, R.style.loading_dialog);
        mLoadingDialog.setCancelable(true);// 可以用"返回键"取消
        mLoadingDialog.setCanceledOnTouchOutside(false);// 设置点击屏幕Dialog不消失
        mLoadingDialog.setContentView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));

        Window window = mLoadingDialog.getWindow();
        window.setGravity(Gravity.CENTER);  //此处可以设置dialog显示的位置

        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mLoadingDialog.dismiss();
            }
        });

        mLoadingDialog.show();

    }
    private  class CliceListener implements View.OnClickListener {
        Dialog mDialog;
        private Context mContext;
        private TextView mTextView;

        public CliceListener(Dialog dialog,TextView textView) {
            mDialog = dialog;
            mTextView = textView;
        }

        public CliceListener(Dialog dialog,Context context,TextView textView) {
            mDialog = dialog;
            mContext = context;
            mTextView = textView;
        }

        @Override
        public void onClick(View v) {
            switch (v.getId()){
                case R.id.tv_fx_wx:
                  //比如分享到QQ，其他平台则只需要更换平台类名，例如Wechat.NAME则是微信
                    Platform plat = ShareSDK.getPlatform(Wechat.NAME);
                    showShare(plat.getName(),mContext,mTitle,mUrl,content);
                    break;
                case R.id.tv_fx_pyq:
                    Platform plat1 = ShareSDK.getPlatform(WechatMoments.NAME);
                    showShare(plat1.getName(),mContext,mTitle,mUrl,content);
                    break;
                case R.id.tv_qx:
                    mDialog.dismiss();
                    break;
                case R.id.tv_cancel:
                    mDialog.dismiss();
                    break;
                case tv_sure: //户型
                    mTextView.setText(wheelData1+wheelData2+wheelData3);
                     RxBus.getInstance().post(new HouseArea(wheelData1,wheelData2,wheelData3));
                    mDialog.dismiss();
                    break;
                case R.id.tv_sure1:
                    mTextView.setText(mList.get(wheelInt));
                    mDialog.dismiss();
                    break;
                case R.id.tv_sure_ad:
                    RxBus.getInstance().post( new CiyiInfoBean(mCityInfoLitePals.get(mAreaPoint),cityInfoLitePals1.get(DialogUtils.mPosition)) );
                    mDialog.dismiss();
                    break;
                case R.id.tv_sure_lc:
                    RxBus.getInstance().post(new FloorBean(holLc,pointLc));
                    mDialog.dismiss();
                    break;

            }

        }
    }
    private  void showShare(String platform,Context context,String title,String url,String content) {
        final OnekeyShare oks = new OnekeyShare();
        //指定分享的平台，如果为空，还是会调用九宫格的平台列表界面
        if (platform != null) {
            oks.setPlatform(platform);
        }
        //关闭sso授权
        oks.disableSSOWhenAuthorize();

        // title标题，印象笔记、邮箱、信息、微信、人人网和QQ空间使用
       oks.setTitle(title);
        // titleUrl是标题的网络链接，仅在Linked-in,QQ和QQ空间使用
       // oks.setTitleUrl("http://sharesdk.cn");

        // text是分享文本，所有平台都需要这个字段
        oks.setText(content);
        //分享网络图片，新浪微博分享网络图片需要通过审核后申请高级写入接口，否则请注释掉测试新浪微博
         oks.setImageUrl("http://www.sifangtengda.top/static/img/ico.png");
        // imagePath是图片的本地路径，Linked-In以外的平台都支持此参数
        //oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
        // url仅在微信（包括好友和朋友圈）中使用
       oks.setUrl(url);

        //启动分享
        oks.show(context);
    }
    private  class IntemListener implements WheelPicker.OnItemSelectedListener {
        @Override
        public void onItemSelected(WheelPicker picker, Object data, int position) {
            switch (picker.getId()){
                case R.id.wheel:
                    wheelInt = position;
                    break;
                case R.id.wheel1:
                    wheelData1Int = position;
                    wheelData1 = (String)data; //室
                    break;
                case R.id.wheel2:
                    wheelData2Int = position;
                    wheelData2 = (String)data; //厅
                    break;
                case wheel3:
                    wheelData3Int = position;
                    wheelData3 = (String)data;//卫
                    break;

            }

        }
    }
}
